home *** CD-ROM | disk | FTP | other *** search
- /*
- * $Source: /afs/athena.mit.edu/user/j/jon/mac/MIT/CIncludes/bsd/RCS/bsd-mac-compat.h,v $
- * $Author: jon $
- * $Header: /afs/athena.mit.edu/user/j/jon/mac/MIT/CIncludes/bsd/RCS/bsd-mac-compat.h,v 1.6 90/03/16 21:40:10 jon Exp $
- *
- * Copyright 1989 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: Mac with MPW C.
- */
-
- #ifndef _BSD_MAC_COMPAT_
- #define _BSD_MAC_COMPAT_
-
- #ifndef MacOS
- #define MacOS
- #endif
-
- /* Berkeley type string functions */
- #define bcmp memcmp
- #define bzero(ptr, len) memset ((ptr), 0, (len))
- #define index strchr
- #define rindex strrchr
- #define bcopy(s,d,n) memcpy(d,s,n)
-
- #include <String.h>;
-
- #include <Fcntl.h>;
- #include <Stdio.h>;
- #include <Errno.h>;
-
- #define getuid() 0
-
- #define u_long unsigned long
- #define u_short unsigned short
- #define caddr_t char *
- #define u_char unsigned char
-
- #define uid_t unsigned short
- #define gid_t unsigned short
- #define off_t long int
-
- /* from <sys/param.h> */
- #define MAXPATHLEN 1024
-
- #include "bsd-netinet-in.h"
- #include "bsd-netdb.h"
- #include "bsd-arpa-inet.h"
- #include "bsd-sys-socket.h"
-
- struct timeval {long tv_sec; long tv_usec;};
- struct timezone {int tz_minuteswest; int tz_dsttime;};
-
- #include <Time.h>
-
- /* BSD errno.h additions (network, socket) */
- #include "bsd-errno.h"
-
- #define write(fd, buf, len) socket_write(fd, buf, len)
- #define read(fd, buf, len) socket_read(fd, buf, len)
- #define close(fd) socket_close(fd)
-
- /* for select */
-
- #define NBBY 8 /* number of bits in a byte */
- /*
- * Select uses bit masks of file descriptors in longs.
- * These macros manipulate such bit fields (the filesystem macros use chars).
- * FD_SETSIZE may be defined by the user, but the default here
- * should be >= NOFILE (param.h).
- */
- #ifndef FD_SETSIZE
- #define FD_SETSIZE 256
- #endif
-
- typedef long fd_mask;
- #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
- #ifndef howmany
- #define howmany(x, y) (((x)+((y)-1))/(y))
- #endif
-
- typedef struct fd_set {
- fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
- } fd_set;
-
- #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
- #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
- #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
- #define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
-
- #endif /* _BSD_MAC_COMPAT_ */
-